
package jz.dataCenter.extractData;

import jg.exJson.collection.CollectionJson;
import jz.utils.JzConstants;
import SoftFan.util.textUnit;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

public class ExtractCollectionData {

	public String exec(jz.dbUnit.collectionData.collectionData data) throws Exception {
		jz.dbUnit.gjzxxSimp.GJZXX gjzxx = jz.dbUnit.gjzxxSimp.GJZXXJDBCUnit.getInstance().loadByPrimaryKey(data.getGjzid());
		if (gjzxx == null) {
			return null;
		}
		try {
			CollectionJson collection = new CollectionJson();
			try {
				collection.setId(data.getId());
				
				collection.setJz(JzConstants.getInstance().getJzName());
				collection.setCjd(textUnit.ObjToString(data.getCjidDisplay()));
				
				collection.setCjzxpersonid(data.getCjzxpersonid());
				
				collection.setMacId(data.getMacId());

				collection.setSfz(gjzxx.getSfz());

				collection.setXjztid(data.getXjztid());

				collection.setCjrq(data.getCjrq());

				collection.setNote(data.getNote());
				
				collection.setXjl(data.getXjl());
				collection.setAnticoagulant(data.getAnticoagulant());
				collection.setBloodgross(data.getBloodgross());
				collection.setXhcs(data.getXhcs());
				collection.setCjhs(data.getCjhs());

				collection.setNs(data.getNs());
				collection.setNsactual(data.getNsactual());
				collection.setAcquisitionspeed(data.getAcquisitionspeed());
				collection.setReinfusionspeed(data.getReinfusionspeed());
				collection.setSingleplasmacollection(data.getSingleplasmacollection());
				
				collection.setBatchno(data.getBatchno());
				collection.setAnticoagulantsbatchno(data.getAnticoagulantsbatchno());
				collection.setNsbatchno(data.getNsbatchno());
				
				collection.setCafactory(textUnit.ObjToString(data.getCafactoryDisplay()));
				collection.setAgfactory(textUnit.ObjToString(data.getAgfactoryDisplay()));
				collection.setNsfactory(textUnit.ObjToString(data.getNsfactoryDisplay()));

				collection.setYcs(data.getYcs());

				return JSON.toJSONString(collection, SerializerFeature.WriteNullListAsEmpty);
			} finally {
				collection.free();
			}
		} finally {
			gjzxx.freeData();
		}
	}

}
